#ifndef R250_H
#define R250_H

/**
* A class to create random numbers using the r250 uniform random number algorithm
*
* @note R250 is not thread safe
*/
class R250
{
	public:
		R250();
		/**
		* A constructor the seeds the RNG
		* 
		* @param sd seed value
		*/
		R250(const long sd);

		~R250();
 
		/**
		* Seeds the RNG see: init 
		*
		* @param sd seed value
		* 
		* @return returns seed value
		*/
		long seed(const long sd = 0);
		
		/**
		* Returns a random integer
		*
		* @return a random integer
		*/
		unsigned long int rani(void);

	private:
		/**
		* Seeds the RNG
		*
		* @param sd seed value
		*/
		void init(const long int sd);

	private:
		static int serial;					/**< serial number used to seed if the seed is not given						*/
		unsigned long int *r250_buffer;		/**< buffer used to create the random numbers, internal to the R250 algorithm	*/
		int r250_index;						/**< index into the r250_buffer, internal to the R250 algorithm					*/
};

inline
R250::R250(const long sd)
{
	r250_buffer = (unsigned long int*)0;
	r250_index = 0;

	seed(sd);
}

inline
R250::~R250()
{
	delete [] r250_buffer;
}

#endif
